package com.shop.service.impl;

import com.shop.dao.ExtCproductDao;
import com.shop.dao.SysCodeDao;
import com.shop.domain.ExtCproduct;
import com.shop.domain.Page;
import com.shop.domain.SysCode;
import com.shop.service.ExtCproductService;
import com.shop.util.IDUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * ExtCproductServiceImpl
 * Created by heqianqian on 2017/7/18.
 */
@Service
public class ExtCproductServiceImpl implements ExtCproductService<ExtCproduct> {

    @Resource
    private ExtCproductDao<ExtCproduct> extCproductDao;

    @Override
    public List findPage(Page page) {
        return null;
    }

    @Override
    public List<ExtCproduct> find(Map paraMap) {
        return extCproductDao.find(paraMap);
    }

    @Override
    public ExtCproduct get(Serializable id) {
        return null;
    }

    @Override
    public void insert(ExtCproduct extCproduct) {
        extCproduct.setAmount(extCproduct.getcNumber() * extCproduct.getPrice());
        extCproduct.setExtCproductId(IDUtils.getId());
        extCproductDao.insert(extCproduct);
    }

    @Override
    public void update(ExtCproduct extCproduct) {
        extCproduct.setAmount(extCproduct.getcNumber() * extCproduct.getPrice());
        extCproductDao.update(extCproduct);
    }

    @Override
    public void deleteById(Serializable id) {
        extCproductDao.deleteById(id);
    }

    @Override
    public void delete(Serializable[] ids) {

    }

    @Override
    public ExtCproduct finById(Long extCproductId) {
        return extCproductDao.findById(extCproductId);
    }
}
